-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: propagate monitor errors to the frontend #1965
Conversation
305b1b8
to
eb2fc72
Compare
I have verified the followings:
I could not upload to 33 BLE on Windows. I restarted my notebook and ran the CMD.exe as an Administrator, but it did not help:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I perform the steps described in #1508 I get an incorrect message in the input field of the Serial Monitor view:
The problem that caused the monitor initialization to fail is that I had the port open in another application. I already have the correct board and port selected, so this "Select a board and a port to connect automatically." advice is wrong.
@91volt, please help with how this should work. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I perform the steps described in #1508, there is a delay of ~15 seconds before the "Port monitor error: command 'open' failed: Serial port busy." notification appears.
The error appears in the logs immediately upon opening the Serial Monitor view:
2023-03-24T07:58:20.085Z monitor-service ERROR Error: 2 UNKNOWN: Port monitor error: command 'open' failed: Serial port busy
at Object.callErrorFromStatus (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\call.js:31:19)
at Object.onReceiveStatus (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\client.js:413:49)
at Object.onReceiveStatus (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
at E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\call-stream.js:187:78
at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
at ServiceClientImpl.makeBidiStreamRequest (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\client.js:398:30)
at ServiceClientImpl.monitor (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@grpc\grpc-js\build\src\make-client.js:105:19)
at MonitorService.createDuplex (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\arduino-ide-extension\lib\node\monitor-service.js:157:34)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\arduino-ide-extension\lib\node\monitor-service.js:220:37
at async retry (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@theia\core\lib\common\promise-util.js:73:20)
at async MonitorService.start (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\arduino-ide-extension\lib\node\monitor-service.js:135:13)
at async MonitorManager.startMonitor (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\arduino-ide-extension\lib\node\monitor-manager.js:89:13)
at async JsonRpcProxyFactory.onRequest (E:\incoming\review\1965\1-c0ca295\resources\app\node_modules\@theia\core\lib\common\messaging\proxy-factory.js:132:24)
Then it retries the monitor initialization 9 more times before finally showing the notification.
Nothing new. See here: #1966.
This is precisely the same behavior as on the
arduino-ide/arduino-ide-extension/src/node/monitor-service.ts Lines 362 to 375 in 9b49712
|
I didn't intend to imply it was something new. I mentioned it because it shows that the delay does not have an external cause. Arduino IDE knows right away that the monitor initialization failed, but doesn't immediately show the notification.
Something has changed. Arduino IDE now shows a notification that the monitor initialization failed. There is no notification at all on The problem is there is an unnecessarily long delay before the notification appears. |
12efc24
to
a0a3bf4
Compare
I made the changes. Please review. Thanks |
8d3eb32
to
9b8e941
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me! I just left some remarks, but they're definitely not blocking.
P.S.: for this review I focused mainly on the code and only did some basic tests of the functionality; let me know if you want me to test it more deeply.
Follow up on this: all comments have been addressed. Thank you, Akos! |
Motivation
This PR enables clear communication of the problem when starting a monitor process fails.
Shows monitor connection status in the
<input>
1508.mp4
Change description
Propagate error from backend to frontend via the monitor ws.
Open the ws connection before creating the monitor duplex. Otherwise, the status update or error cannot reach the frontend.
Fixed monitor widget DI.
Fixed monitor service lifecycle inside the widget.
onBeforeAttach
happened multiple times on IDE2 start if the widget was previously opened.Fixed
connect
when creating the ws connection to the monitor. Previously, the promise might have been resolved before the wsOPEN
event.Moved monitor state to common.
Monitor client proxy waits for reconciled boards after the app startup, then starts the monitor.
Replaced the
connected: boolean
with a fine-grainedconnectionStatus
and kept the code backward compatible with the plotter app.Add translation for
baud
rate.Smoother monitor widget re-render on monitor reset. (On monitor reset, the monitor widget is forcefully re-rendered causing the
<input
> and<select>
s to disappear for a short time #1985)1985.mp4
<input>
is readOnly and keeps the user input. (The monitor<input>
is not readOnly when there is no connection to the monitor #1984)1984.mp4
enumerateMonitorPortSettings
and the platform is not installed #1974)1974.mp4
682.mp4
Aligned HC warning colors with the error colors:
2.0.4:
PR:
Other information
Closes #1508
Closes #1985
Closes #1984
Closes #1974
Ref #682
Reviewer checklist